_package("caf.ui");

_import("caf.mui.Pane");
_import("caf.ui.PaneCap");

/**
 * homeshell主面板
 */
_class("PaneShell", Pane, function(){
	this._init = function(){
		_super._init.call(this);
		this._container = null;
		this._dialogueBar = null;
		this._paneCap = null;
	};
	this.create = function(parent, app){
		this.setParent(parent);
		this._app = app;
		var obj = this.createTplElement(parent, "pane_shell.xml");
		this.init(obj);
		return obj;
	};
	this.init = function(obj){
		_super.init.apply(this, arguments);
		this._container = this.find(".app-workspace");
		this._dialogueBar = this.find(".dialogue-bar");
		this._paneCap = new PaneCap();
		this._paneCap.create(this, this._app);
		this._paneCap.setVisible(false);
	};
	this.dispose = function(){
		this._paneCap.dispose();
		this._paneCap = null;
		this._dialogueBar = null;
		this._container = null;
		_super.dispose.apply(this);
	};
	this.getContainer = function(){
		return this._container;
	};
	/**
	 * 隐藏对话栏，调整homeshell外壳外观，模拟真实环境下的外观
	 */
	this.hideDialogueBar = function(){
		this._container.style.height = "769px";
		this._dialogueBar.style.display = "none";
	};
	/**
	 * 显示或隐藏CloudApp编辑面板
	 */
	this.showPaneCap = function(v, callback){
		if(v){
			this._paneCap._callback = callback;
		}
		this._paneCap.setVisible(v);
	};
});